import Vue from 'vue'
import Router from 'vue-router'
// 导入 useVant
const UseVant = () => import('../views/useVant')
// 导入 login
const Login = () => import('../views/login')
// 导入 index
const Index = () => import('../views/index')
// 导入 layout
const Layout = () => import('../views/layout')
// 导入 my
const My = () => import('../views/my')
// 导入 搜索
const Search = () => import('../views/search')
// 导入搜索结果
const SearchResult = () => import('../views/searchResult')
// 导入详情
const Detail = () => import('../views/detail')
// 导入个人信息
const UserInfo = () => import('../views/userInfo')
// 导入小智同学
const Zhi = () => import('../views/zhi')

Vue.use(Router)

export default new Router({
  routes: [
    // 设置重写向
    {
      path: '/',
      redirect: '/index'
    },
    // 添加路由：UseVant
    {
      path: '/usevant',
      component: UseVant
    },
    // 登录路由
    {
      path: '/login',
      component: Login
    },
    // 验证登录的路由：
    {
      path: '/checkLogin',
      component: Login
    },
    // 设置 layout
    {
      path: '/layout',
      component: Layout,
      children: [
        // 首页路由
        {
          path: '/index', // 请求的路由： /index
          component: Index
        },
        // 我的路由
        {
          path: '/my',
          component: My
        },
        // 设置搜索路由
        {
          path: '/search',
          component: Search
        }
      ]
    },
    // 设置 SearchResult
    {
      path: '/searchResult',
      component: SearchResult
    },
    // 设置一个详情页面
    {
      path: '/detail',
      component: Detail
    },
    // 个人信息
    {
      path: '/userInfo',
      component: UserInfo
    },
    // 小智同学
    {
      path: '/zhi',
      component: Zhi
    }
  ]
})
